package com.dqhl.business.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.dqhl.business.R;
import com.dqhl.business.modle.GoodsType;
import com.dqhl.business.util.ViewHolder;

import java.util.List;

/**
 * Created by guanluocang on 2016/11/8.
 */
public class AddPromotionSinglePopWindowAdapter extends BaseAdapter {

    private Context context;
    private LayoutInflater inflater;
    private List<GoodsType> stringList;

    public AddPromotionSinglePopWindowAdapter(Context context, List<GoodsType> stringList) {
        this.context = context;
        this.stringList = stringList;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return stringList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.order_item_popwindow, parent, false);
        }
        TextView tv_choice = ViewHolder.get(convertView, R.id.tv_choice);

        tv_choice.setText(stringList.get(position).getName());
        return convertView;
    }
}
